package com.hulk.ratel




import cn.hutool.log.StaticLog
import lombok.extern.slf4j.Slf4j
import org.springframework.boot.Banner
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.builder.SpringApplicationBuilder
import org.springframework.boot.web.servlet.ServletComponentScan

/**
 * @Author: cmt
 * @E-mail: 29572320@qq.com
 * @Date: Create in 2018/1/22 上午10:02
 * @Version: 1.0.0
 * @Modify by:
 * Class description
 */

@Slf4j
@SpringBootApplication(scanBasePackages = arrayOf("com.hulk.ratel","com.alicp.jetcache.autoconfigure") )
@ServletComponentScan(basePackages = arrayOf("com.hulk.ratel"))
open class SpringBootKotlinApplication {


    companion object {
        @JvmStatic fun main(args: Array<String>) {
            // java -jar aggregationplus-web.jar --spring.profiles.active=product 命令启动具体的环境参数
            val applicationContext = SpringApplicationBuilder()
                    .sources(SpringBootKotlinApplication::class.java/*, "classpath:/config/spring/applicationContext.xml"*/)
                    .bannerMode(Banner.Mode.OFF).run(*args)
            val activeProfiles = applicationContext.environment.activeProfiles
            StaticLog.info("""service started successfully.
                                             The following profiles are active: """+ activeProfiles.joinToString())

        }
    }

}